Skip to content

Add layered config primitives and resilient lazy cache fallback - #33

Merged
abmmhasan merged 15 commits into
mainfrom
foundation-config-layering
Sep 6, 2026
Merged

Add layered config primitives and resilient lazy cache fallback#33
abmmhasan merged 15 commits into
mainfrom
foundation-config-layering

Conversation

@abmmhasan

Copy link
Copy Markdown
Member

Summary

This introduces the ArrayKit-side configuration primitives needed by Foundation's lower-library utilization pass without changing existing Config::merge() or ArrayMulti::mergeRecursiveDistinct() semantics.

Changes

  • add ConfigMerge for recursive associative-map overlay with atomic list replacement
  • add LayeredLazyFileConfig with explicit fallback < source < overrides precedence
  • guarantee layered exact-path reads match fully merged namespace semantics, including list/scalar shadowing
  • add ResilientLazyFileConfig so corrupt generated namespace caches fall back to authoritative source files
  • treat malformed/invalid lazy __flat.php indexes as disposable cache misses
  • make Environment::all() include process-only getenv() values with the same $_ENV > $_SERVER > getenv() precedence as direct reads
  • add regression coverage for environment enumeration, merge semantics, structural shadowing, and cache corruption fallback
  • document the new configuration-layering behavior

Foundation migration

After this lands, Foundation can replace its local ConfigMerger, move fallback/source/override resolution to LayeredLazyFileConfig, and remove its cache-corruption recovery wrapper around ArrayKit lazy config.

Compatibility

Existing merge APIs retain their current behavior. The list-replacing semantics are exposed through the new explicit ConfigMerge API.

Comment thread src/Config/ConfigMerge.php Fixed
Comment thread src/Config/LayeredLazyFileConfig.php Fixed
Comment thread src/Config/Support/Environment.php Fixed
@abmmhasan
abmmhasan merged commit 053440b into main Sep 6, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants